//
//  HelpCenterViewController.m
//  PPDL
//
//  Created by 王洋 on 2019/7/24.
//  Copyright © 2019 王洋. All rights reserved.
//

#import "PPSettingCell.h"
#import "HelpCenterViewController.h"

@interface HelpCenterViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableview;

@property (nonatomic, strong) NSMutableArray <PP_jumpModel *>*listArray;

@property (nonatomic, strong) NSMutableArray *configArray;

@end

@implementation HelpCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self initView];
    [self prepareData];

}

- (void)prepareData {
    
    self.listArray = @[].mutableCopy;
    
    
    for (int i = 0; i< self.configArray.count; i++) {
        
        
        NSDictionary *dic = self.configArray[i];
        PP_jumpModel *model = [PP_jumpModel new];
        model.title = [dic valueForKey:@"title"];
        model.type = (CommentClickType)[[dic valueForKey:@"type"] integerValue];

//        model.type = (CommentClickType)[[dic valueForKey:@"type"] integerValue];
        model.ID = [dic valueForKey:@"ID"];;
        [self.listArray addObject:model];
    }
    
    [self.tableview reloadData];
    
}

- (void)initView {
    
    self.title = @"帮助中心";
    
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    self.tableview.backgroundColor = PP_Default_Color_Gray_F1F1F1;
    [self.tableview registerNib:[UINib nibWithNibName:@"PPSettingCell" bundle:nil] forCellReuseIdentifier:@"PPSettingCellID"];
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.tableview reloadData];
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    PPSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:@"PPSettingCellID" forIndexPath:indexPath];
    cell.selectionStyle =UITableViewCellSelectionStyleNone;
    
    [cell fillCellWithModel:self.listArray[indexPath.row]];
    
    return cell;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.listArray.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 50;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    PP_jumpModel *model = self.listArray[indexPath.row];
    [[TTJumpManager share] pushViewControllerWithModel:model];
    
}


- (NSMutableArray *)configArray {
    
    return @[
             @{@"title":@"联系客服",
               @"type":@(CommentClickType_PhoneCall),
               @"ID":@"4000331898"},
             
             @{@"title":@"常见问题",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_COMMON_PROBLEM]},
             
             @{@"title":@"推广操作流程",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_PROMOTION_PROCESS]},
             
             @{@"title":@"获取收益操作流程",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_ACQUIR_REVENUE_PROCESS]},
             
             @{@"title":@"参加拍卖操作流程",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_PARTICIPATE_AUCTION_PROCESS]},
//
//             @{@"title":@"抢拍流程",
//               @"type":@(CommentClickType_HtmlPage),
//               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_SHOOT_PROCESS]},
//

             @{@"title":@"登录注册操作流程",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_LOGIN_PROCESS]},
             
             @{@"title":@"拍拍得利小百科",
               @"type":@(CommentClickType_HtmlPage),
               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_PPDL_BAIKE]},
             
//
//             @{@"title":@"实名认证操作流程",
//               @"type":@(CommentClickType_HtmlPage),
//               @"ID":[NSString stringWithFormat:@"%@%@",TT_Global_H5_Domain,TT_HTML_REALNAME_AUTH_PROCESS]},

             ].mutableCopy;
}

@end
